// pages/caicaicai/index.js
var numUser;
var numComputer;
Page({
  data:{
    focus:true,
    //list:[]
    
},
  inputData: function(e){
    numUser = parseInt(e.detail.value);
  },
  caicaicai:function(e){
    let list=this.data.list
    if(list==null)list=[]
    console.log("list的值",list)
    list.push(numUser)
    if(list.length>=8)list.shift()
  var mess=null;
  if(numUser == numComputer){
    mess='恭喜你，猜对了';
  }else if (numUser < numComputer){
    mess='Sorry,猜小了';
  }else{
    mess="Sorry,猜大了";
  }
  this.setData({result:mess,in:numUser,inkey:''});
  this.setData({result:mess,list,userData:null,focus:true});

},
onLoad:function(options){
  numComputer=Math.floor(Math.random()*100);
  console.log('计算机'+numComputer)
}

})